﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace Mengsk.ProxyDelivery.App.UI.Order
{
    class OrderGoodsRefundConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var order = value as Mengsk.ProxyDelivery.Domain.Order;

            if (order == null)
            {
                return "";
            }


            if (parameter == null || parameter.Equals("1"))
            {
                return order.TotalGoodsMoney - order.PayedGoodsMoney;
            }

            return order.TotalDeliveryMoney - order.PayedDeliveryMoney;

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
